// 添加虚拟字段 likeCount
ArticleSchema.virtual('likeCount', {
  ref: 'Like',
  localField: '_id',
  foreignField: 'article',
  count: true
});

// 确保虚拟字段在JSON中可见
ArticleSchema.set('toJSON', { virtuals: true });
ArticleSchema.set('toObject', { virtuals: true }); 